﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Zero.Core;
using Zero.Service;
using Zero.Core.Extensions;
using Zero.Entity.Models;

namespace Zero.Web.Controllers
{
    public class SystemController : BaseController
    {

        private readonly IMenuService menuService;
        public SystemController(IMenuService menuService)
        {
            this.menuService = menuService;
        }
        //
        // GET: /System/

        public ActionResult Index()
        {
            return View();
        }
        
        public ActionResult MenuManage()
        {
            string strUserID = SysContext.CurrentUserID;
            List<Sys_Menu> Menus = menuService.GetAll().Where(m => m.MenuParentID.ToStr() == "").ToList();
            return View(Menus);
        }
        //GET:/System/MenuList/MenuID
        public ActionResult MenuList(string ID)
        {
            Sys_Menu menu = menuService.Get(ID);
            return View(menu);
        }

        ////Add a new Menu
        //public ActionResult MenuDetail()
        //{
        //    Sys_Menu menu = new Sys_Menu();
        //    menu.MenuID = Guid.NewGuid().ToStr();
        //    return View(menu);
        //}

        //Update a existed Menu
        public ActionResult MenuDetail( string ID,string Op)
        {
            Sys_Menu menu = new Sys_Menu();
            menu = menuService.Get(ID);
            
            return View(menu);
        }

    }
}
